<?php
/**
 * ===============================================
 * 版权所有 2019-2050 青岛铁锤科技有限公司，并保留所有权利。
 * 网站地址: http://www.huaxianling.com
 * ===============================================
 * Author: Wyp
 */

namespace App\Modules\Live\Repositories;


use App\Models\Authentication;
use App\Modules\Live\Validators\AuthenticationValidator;
use Flower\Core\Repository\Eloquent\BaseRepository;

class AuthenticationRepository extends BaseRepository
{
    public function model()
    {
        return Authentication::class;
    }

    public function validator()
    {
        return AuthenticationValidator::class;
    }

    /**
     * 身份认证
     * @param $user_id
     * @param $name
     * @param $identity
     * @return mixed
     */
    public function createAuthentication($user_id,$name,$identity)
    {
        $data = [
            'user_id' => $user_id,
            'name' => $name,
            'identity' => $identity,
        ];

        return $this->create($data);
    }

    /**
     * 获取认证
     * @param $user_id
     * @return mixed
     */
    public function getAuthentication($user_id)
    {
        $authentication = $this->findWhere(['user_id'=>$user_id],['id'])->first();
        return $authentication;
    }
}